package cn.lin.task.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;



@Entity
@Table(name="t_task")
public class Task {
	private int tid;
	private String taskname;
	private String context;
	private Date createDate;
	private Date lastDate;
	private User user;
	private boolean isFinish;
	
	public Task() {
	
	}

	public Task(String taskname, String context, Date createDate, Date lastDate,boolean isFinish) {
		this.taskname = taskname;
		this.context = context;
		this.createDate = createDate;
		this.lastDate = lastDate;
		this.isFinish=isFinish;
	}
	
	@Id 
	@GeneratedValue(generator = "persistenceGenerator")    
	@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
	public int getTid() {
		return tid;
	}
	public void setTid(int tid) {
		this.tid = tid;
	}
	public String getTaskname() {
		return taskname;
	}
	public void setTaskname(String taskname) {
		this.taskname = taskname;
	}
	public String getContext() {
		return context;
	}
	public void setContext(String context) {
		this.context = context;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Date getLastDate() {
		return lastDate;
	}
	public void setLastDate(Date lastDate) {
		this.lastDate = lastDate;
	}
	@ManyToOne
	@JoinColumn(name="uid")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

	public boolean getIsFinish() {
		return isFinish;
	}


	public void setIsFinish(boolean isFinish) {
		this.isFinish = isFinish;
	}

	@Override
	public String toString() {
		return "Task [tid=" + tid + ", taskname=" + taskname + ", context=" + context + ", createDate=" + createDate
				+ ", lastDate=" + lastDate + ", user=" + user + ", isFinish=" + isFinish + "]";
	}
	
	
}
